-
-
Notifications
You must be signed in to change notification settings - Fork 624
Add toolsetpath API for specifying tool executable paths #2462
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
8fd8b95
to
c0187fd
Compare
Introduces a new API function `toolsetpath(toolsetName, toolName, toolPath)` that allows users to specify custom paths for tool executables within their Premake scripts. This provides a mechanism to override the default tool lookup behavior for specific toolsets and tools, offering greater flexibility in build configurations. Changes include: - Registering the `toolsetpaths` field in `_premake_init.lua` to store the custom paths. - Implementing the `toolsetpath` function in `base/api.lua` to process and store the provided paths. - Modifying the `gettoolname` functions in the GCC, Clang, MSVC, SNC, .NET, and Emscripten toolset modules to check for and use paths defined via `toolsetpaths` before falling back to default lookup logic. - Adding tests in the corresponding toolset test files (`tests/tools/`) to verify that the `toolsetpath` setting correctly overrides the default behavior. - Creating a new documentation page (`website/docs/toolsetpath.md`) detailing the API function, its parameters, and usage. - Adding an entry for the new documentation page in the website sidebar (`website/sidebars.js`).
c0187fd
to
315ca63
Compare
-- Check toolsetpaths first | ||
if cfg.toolsetpaths and cfg.toolsetpaths[cfg.toolset] and cfg.toolsetpaths[cfg.toolset][tool] then | ||
return cfg.toolsetpaths[cfg.toolset][tool] | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be fine to have something like:
function toolset.gettoolname(toolset, config, tool)
to factorize that code.
but probably not possible as it is already used by exporters :-/
@@ -22,7 +22,13 @@ emcc.tools = { | |||
-- flags correctly to emcc builds. | |||
emcc.shared.profile = nil | |||
emcc.ldflags.profile = nil | |||
emcc.getsharedlibarg = function(cfg) return "" end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems unrelated to that PR.
-- Verify that toolsetpath overrides the default tool name. | ||
-- | ||
function suite.toolsetpathOverridesDefault() | ||
toolset "clang" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it needed?
prepare() | ||
test.isequal("/path/to/my/custom/clang", clang.gettoolname(cfg, "cc")) | ||
end | ||
|
||
-- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
toolsetpaths
is not tested.
How it behaves if we mix toolsetpath
and toolsetpaths
?
At which level the table are merged?
Introduces a new API function
toolsetpath(toolsetName, toolName, toolPath)
that allows users to specify custom paths for tool executables within their Premake scripts.This provides a mechanism to override the default tool lookup behavior for specific toolsets and tools, offering greater flexibility in build configurations.
Changes include:
toolsetpaths
field in_premake_init.lua
to store the custom paths.toolsetpath
function inbase/api.lua
to process and store the provided paths.gettoolname
functions in the GCC, Clang, MSVC, SNC, .NET, and Emscripten toolset modules to check for and use paths defined viatoolsetpaths
before falling back to default lookup logic.tests/tools/
) to verify that thetoolsetpath
setting correctly overrides the default behavior.website/docs/toolsetpath.md
) detailing the API function, its parameters, and usage.website/sidebars.js
).